﻿package com.shareach.domain.common;


import com.shareach.util.Levenshtein;

public class Bind {

	// 来源网站[参见 来源网站 @BaseSiteDomain]
	private String site;
	// 来源网站Id
	private String siteId;
	private String brandName;
	private String orgName;
	private String name;
	private String addr;

	@Override
	public boolean equals(Object obj) {
		if (obj instanceof Bind) {
			Bind parabind = (Bind) obj;
			if (this.site != null && this.name != null && this.siteId != null && parabind.getSite() != null
					&& parabind.getSiteId() != null && parabind.getName() != null) {
				if (this.site.equals(parabind.getSite()) && this.siteId.equals(parabind.getSiteId())) {
					Float sim = Levenshtein.getSimilarityRatio(this.name, parabind.getName());
					if (sim > 0.7) {
						return true;
					}
				}
			}
		}
		return false;
	}

	public String getAddr() {
		return addr;
	}

	public String getBrandName() {
		return brandName;
	}

	public String getName() {
		return name;
	}

	public String getOrgName() {
		return orgName;
	}

	public String getSite() {
		return site;
	}

	public String getSiteId() {
		return siteId;
	}

	@Override
	public int hashCode() {
		return 37;
	}

	public void setAddr(String addr) {
		this.addr = addr;
	}

	public void setBrandName(String brandName) {
		this.brandName = brandName;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}

	public void setSite(String site) {
		this.site = site;
	}
	// @Override
	// public String toString() {
	// return "Bind [site=" + site + ", id=" + id + ", brandName=" + brandName
	// + ", orgName=" + orgName + ", addr=" + addr + "]";
	// }

	public void setSiteId(String siteId) {
		this.siteId = siteId;
	}
}
